class Solution(object):
    def findWords(self, words):
        """
        :type words: List[str]
        :rtype: List[str]
        """

        def convert(s):
            if s in {'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'}:
                return 'Q'
            if s in {'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L'}:
                return 'A'
            return 'Z'

        out = []
        for j, word in enumerate(words):
            word = word.upper()
            base = convert(word[0])
            flag = True
            for i in range(1, len(word)):
                if convert(word[i]) != base:
                    flag = False
                    break
            if flag:
                out.append(words[j])

        return out


data = Solution()
words = ["QWe"]
print(data.findWords(words))
